﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using static AD.Pms.Api.Entities.Enums.CommonEnum;

namespace AD.Pms.Api.Entities
{
    public class Role
    {
        /// <summary>
        /// 角色实体类
        /// </summary>
        public Role()
        {
            UserRoles = new HashSet<UserRoleMapping>();
            Permissions = new HashSet<RolePermissionMapping>();
        }
        /// <summary>
        /// 
        /// </summary>
        [Required]
        [Key]
        public string Code { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [Required]
        public string Name { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public Status Status { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public IsDelete IsDelete { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateBy { get; set; }

        /// <summary>
        /// 创建者ID
        /// </summary>
        public Guid CreatedByUserGuid { get; set; }

        /// <summary>
        /// 创建者姓名
        /// </summary>
        public string CreatedByUserName { get; set; }

        /// <summary>
        /// 最近修改时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }

        /// <summary>
        /// 最近修改者ID
        /// </summary>
        public Guid? ModifiedByUserGuid { get; set; }

        /// <summary>
        /// 最近修改者姓名
        /// </summary>
        public string UpdateBy { get; set; }

        /// <summary>
        /// 是否是超级管理员(超级管理员拥有系统的所有权限)
        /// </summary>
        public bool IsSuperAdministrator { get; set; }

        /// <summary>
        /// 是否是系统内置角色(系统内置角色不允许删除,修改操作)
        /// </summary>
        public bool IsBuiltin { get; set; }

        /// <summary>
        /// 角色拥有的用户集合
        /// </summary>
        public ICollection<UserRoleMapping> UserRoles { get; set; }

        /// <summary>
        /// 角色拥有的权限集合
        /// </summary>
        public ICollection<RolePermissionMapping> Permissions { get; set; }
    }
}
